GBML manual / Screen

overlay_area

Puts the Area of the overlay effect that is playing with its top-left corner at the spot (x, y) on the screen, counted from the screen’s top-left corner. A band only moves up and down (it is the whole width). Call it after overlay_start; it does nothing for an effect with no Area.

Works differently on Game Boy - The Game Boy keeps an effect's Area to its rows, exactly: the Wobble, Stretch, Blocks, Sky color and the picture's Brightness (not the sprites') work in those rows only, and a box becomes its rows across the whole width.

Works differently on Game Boy Color - The Game Boy Color keeps an effect's Area to its rows, exactly: the Wobble, Stretch, Blocks and Sky color of the effect work in those rows only, a box becomes its rows across the whole width, and a Brightness, a Tint and a Shape still work on the whole screen.

Works differently on Sega Genesis - The Sega Genesis plays the Area of a Wobble its own way: the Wobble is kept to the Area's rows, the whole width of the screen (the chip moves a whole line, so a box's sides are not cut); this puts the Area's top line where the spot says.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

overlay_area(x, y)

Arguments

NameType
xint
yint

Returns

Nothing.

Description

Puts the Area of the playing overlay effect with its top-left corner at the spot (x, y) on the screen, counted from the screen's top-left corner. An Area is the part of the screen an effect works on: a band of rows or a box, chosen in the Overlay Effects tab. A band is the whole width of the screen, so it only moves up and down.

Call it after overlay_start (starting an effect puts its Area back where the tab says). It does nothing for an effect that has no Area. The numbers are places on the screen, not in the room. To keep an Area on an object, use overlay_area_follow and let the game take the camera away for you.

An Area costs the console more than a plain effect, so use it sparingly. The Overlay Effects tab says what it costs, and Overlay effects explains it.

Example

overlay_start(ov_doc_flash);
overlay_area(60, 20);

The effect starts, and its Area has its top-left corner 60 across and 20 down from the top-left corner of the screen.

On the GBA

An Area is made in the Overlay Effects tab (a band of rows, or a box) and is where the effect starts. This moves it, in screen pixels, not room pixels: take away the camera’s place first, or use overlay_area_follow and let the game do it. It stops an earlier overlay_area_follow. The Area keeps its size. It costs nothing but the work of moving a window once a frame. A box that uses a window or a copy of a layer is explained on the overlay_start page and in the Overlay Effects tab.

See also: Overlay effects - screen effects you make yourselfoverlay_area_followoverlay_startoverlay_focusoverlay_stop